#define _CRT_SECURE_NO_WARNINGS  1
#include<stdio.h>
#include<string.h>

int main()
{
    char arr[100] = { 0 };
    char arr2[100] = { 0 };
    int i = 0;
    int len = 0;
    int j = 0;
    gets_s(arr);
    len = strlen(arr);
    for (i = len - 1; i >=0; i--)
    {
        arr2[j] = arr[i];
        j++;
        if (arr[i] == ' ')
        {
            for (j = j - 1; j >= 0; j--)
            {
                printf("%c", arr2[j]);
            }
            j = 0;
        }
        if (i==0)
        {
            printf(" ");
            for (j = j-1; j >= 0; j--)
            {
                printf("%c", arr2[j]);
            }
            j = 0;
        }
    }
    return 0;
}
